#pragma once

#include <time.h>

#include "myinputs.h"
#include "gamecode.h"
#include "mydrawengine.h"
#include "Shapes.h"
#include "buttons.h"
#include "controls.h"
#include "PopUps.h"
#include "game.h"

#include "AppleDropGame.h"
#include "SpaceInvaders.h"
#include "Pong.h"

enum ViewTypes {GALAXY, LIST};

const int currentImpPlanets = 3;

const int activeProjects = 20;

class Hub
{
protected:

	PictureIndex thePlanetMaps[activeProjects];

	char planetNames[15][activeProjects];
	int highscores[activeProjects];



};

class GalaxyMap: Hub
{
private:

	PictureIndex theMainMap;

public:
	
	void init(char planetNames[15][activeProjects]);
	void update(MousePointer gTheMouse);
	void draw();

};

typedef Game*(*gameCreator)();


struct planetView
{
	PictureIndex planetBackdrop;

	int planetNo;
	int positionNo;
	char planetName[20];


	PopUp backdrop;
	Button startButton;
	gameCreator theGameCreator;

	Button blurbButton;
};

class ListView: Hub
{
private:

	PictureIndex theBackdrop;

	int currentView;

	Button left;
	Button right;


public:
	
	void init(char planetNames[15][activeProjects]);
	void update(MousePointer gTheMouse);
	void draw(planetView planets[currentImpPlanets]);
	int GetCurrentView();

};



class HubControl
{
	
	MousePointer gTheMouse;

	ViewTypes theCurrentView;

	GalaxyMap g_theGalaxy;
	ListView g_theLists;

	PopUpControl thePopUps;

	char planetNames[15][activeProjects];

	ViewButton theViewButton;

	OptionsButton theOptionsButton;

	ExitButton theExitButton;

	static const int maxFuel = 10;
	int currentScore;
	int currentFuel;
	int currentMoney;

	static const int maxParts = activeProjects;
	bool isActive;

	planetView planets[currentImpPlanets];


public:

	HubControl();
	bool GetActive()const;

	void setActive(bool value);

	void init();
	void update(Game* &pCurrentGame);
	void draw();

	void processGameResult(GameResult theResult);

	MousePointer getMouse();
};